.class Lcom/android/inputmethod/latin/GoogleVoiceManager;
.super Lcom/android/inputmethod/latin/VoiceKeyboardManager;
.source "GoogleVoiceManager.java"


# static fields
.field private static final EXTRA_CALLING_PACKAGE:Ljava/lang/String; = "calling_package"

.field private static final EXTRA_RECOGNITION_CONTEXT:Ljava/lang/String; = "android.speech.extras.RECOGNITION_CONTEXT"

.field private static final EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS:Ljava/lang/String; = "android.speech.extras.SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS"

.field private static final INPUT_COMPLETE_SILENCE_LENGTH_DEFAULT_VALUE_MILLIS:J = 0x3e8L

.field private static final TAG:Ljava/lang/String; = "###### GoogleVoiceManager ######"

.field private static mInstance:Lcom/android/inputmethod/latin/GoogleVoiceManager;


# instance fields
.field private mBlacklist:Lcom/android/inputmethod/latin/Whitelist;

.field private mButton:Landroid/widget/TextView;

.field private mImageView:Landroid/widget/ImageView;

.field private mRecognitionListener:Landroid/speech/RecognitionListener;

.field private mSpeechRecognizer:Landroid/speech/SpeechRecognizer;

.field private mSpeechStart:I

.field private mTitleView:Landroid/widget/TextView;

.field private mUpdateVolumeRunnable:Ljava/lang/Runnable;

.field private mVolume:F

.field private mVolumeSyncObj:[Ljava/lang/Byte;

.field private mWaveBuffer:Ljava/io/ByteArrayOutputStream;

.field private mic_level_drawables:[I


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 66
    const/4 v0, 0x0

    sput-object v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mInstance:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    return-void
.end method

.method private constructor <init>(Lcom/android/inputmethod/latin/LatinIME;Lcom/android/inputmethod/latin/VoiceKeyboardManager$VoiceInputListener;I)V
    .locals 2
    .parameter "context"
    .parameter "listener"
    .parameter "engineId"

    .prologue
    const/4 v0, 0x0

    .line 135
    invoke-direct {p0, p1, p2, p3}, Lcom/android/inputmethod/latin/VoiceKeyboardManager;-><init>(Lcom/android/inputmethod/latin/LatinIME;Lcom/android/inputmethod/latin/VoiceKeyboardManager$VoiceInputListener;I)V

    .line 69
    iput-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mButton:Landroid/widget/TextView;

    .line 71
    iput-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mWaveBuffer:Ljava/io/ByteArrayOutputStream;

    .line 73
    iput-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechRecognizer:Landroid/speech/SpeechRecognizer;

    .line 76
    const/4 v0, 0x7

    new-array v0, v0, [I

    fill-array-data v0, :array_0

    iput-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mic_level_drawables:[I

    .line 87
    const/4 v0, 0x0

    new-array v0, v0, [Ljava/lang/Byte;

    iput-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mVolumeSyncObj:[Ljava/lang/Byte;

    .line 88
    new-instance v0, Lcom/android/inputmethod/latin/GoogleVoiceManager$1;

    invoke-direct {v0, p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager$1;-><init>(Lcom/android/inputmethod/latin/GoogleVoiceManager;)V

    iput-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mUpdateVolumeRunnable:Ljava/lang/Runnable;

    .line 464
    new-instance v0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;

    invoke-direct {v0, p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;-><init>(Lcom/android/inputmethod/latin/GoogleVoiceManager;)V

    iput-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mRecognitionListener:Landroid/speech/RecognitionListener;

    .line 136
    invoke-direct {p0, p1}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->initRecognizer(Landroid/content/Context;)V

    .line 138
    new-instance v0, Lcom/android/inputmethod/latin/Whitelist;

    invoke-direct {v0}, Lcom/android/inputmethod/latin/Whitelist;-><init>()V

    iput-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mBlacklist:Lcom/android/inputmethod/latin/Whitelist;

    .line 139
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mBlacklist:Lcom/android/inputmethod/latin/Whitelist;

    const-string v1, "com.android.setupwizard"

    invoke-virtual {v0, v1}, Lcom/android/inputmethod/latin/Whitelist;->addApp(Ljava/lang/String;)V

    .line 140
    return-void

    .line 76
    nop

    :array_0
    .array-data 0x4
        0x4bt 0x0t 0x2t 0x7ft
        0x4ct 0x0t 0x2t 0x7ft
        0x4dt 0x0t 0x2t 0x7ft
        0x4et 0x0t 0x2t 0x7ft
        0x4ft 0x0t 0x2t 0x7ft
        0x50t 0x0t 0x2t 0x7ft
        0x51t 0x0t 0x2t 0x7ft
    .end array-data
.end method

.method static synthetic access$000(Lcom/android/inputmethod/latin/GoogleVoiceManager;)V
    .locals 0
    .parameter "x0"

    .prologue
    .line 52
    invoke-direct {p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->updateVolumeLevel()V

    return-void
.end method

.method static synthetic access$100(Lcom/android/inputmethod/latin/GoogleVoiceManager;)Ljava/lang/Runnable;
    .locals 1
    .parameter "x0"

    .prologue
    .line 52
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mUpdateVolumeRunnable:Ljava/lang/Runnable;

    return-object v0
.end method

.method static synthetic access$1000(Lcom/android/inputmethod/latin/GoogleVoiceManager;)[Ljava/lang/Byte;
    .locals 1
    .parameter "x0"

    .prologue
    .line 52
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mVolumeSyncObj:[Ljava/lang/Byte;

    return-object v0
.end method

.method static synthetic access$1102(Lcom/android/inputmethod/latin/GoogleVoiceManager;F)F
    .locals 0
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 52
    iput p1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mVolume:F

    return p1
.end method

.method static synthetic access$200(Lcom/android/inputmethod/latin/GoogleVoiceManager;)V
    .locals 0
    .parameter "x0"

    .prologue
    .line 52
    invoke-direct {p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->showSpeakNow()V

    return-void
.end method

.method static synthetic access$300(Lcom/android/inputmethod/latin/GoogleVoiceManager;)Landroid/widget/ImageView;
    .locals 1
    .parameter "x0"

    .prologue
    .line 52
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mImageView:Landroid/widget/ImageView;

    return-object v0
.end method

.method static synthetic access$400(Lcom/android/inputmethod/latin/GoogleVoiceManager;)Landroid/widget/TextView;
    .locals 1
    .parameter "x0"

    .prologue
    .line 52
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mTitleView:Landroid/widget/TextView;

    return-object v0
.end method

.method static synthetic access$500(Lcom/android/inputmethod/latin/GoogleVoiceManager;)Landroid/widget/TextView;
    .locals 1
    .parameter "x0"

    .prologue
    .line 52
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mButton:Landroid/widget/TextView;

    return-object v0
.end method

.method static synthetic access$600(Lcom/android/inputmethod/latin/GoogleVoiceManager;)V
    .locals 0
    .parameter "x0"

    .prologue
    .line 52
    invoke-direct {p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->showListening()V

    return-void
.end method

.method static synthetic access$700(Lcom/android/inputmethod/latin/GoogleVoiceManager;)I
    .locals 1
    .parameter "x0"

    .prologue
    .line 52
    iget v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechStart:I

    return v0
.end method

.method static synthetic access$702(Lcom/android/inputmethod/latin/GoogleVoiceManager;I)I
    .locals 0
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 52
    iput p1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechStart:I

    return p1
.end method

.method static synthetic access$800(Lcom/android/inputmethod/latin/GoogleVoiceManager;)Ljava/io/ByteArrayOutputStream;
    .locals 1
    .parameter "x0"

    .prologue
    .line 52
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mWaveBuffer:Ljava/io/ByteArrayOutputStream;

    return-object v0
.end method

.method static synthetic access$900(Lcom/android/inputmethod/latin/GoogleVoiceManager;Ljava/io/ByteArrayOutputStream;II)V
    .locals 0
    .parameter "x0"
    .parameter "x1"
    .parameter "x2"
    .parameter "x3"

    .prologue
    .line 52
    invoke-direct {p0, p1, p2, p3}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->showWorking(Ljava/io/ByteArrayOutputStream;II)V

    return-void
.end method

.method private drawWave(Ljava/nio/ShortBuffer;Landroid/graphics/Canvas;II)V
    .locals 22
    .parameter "waveBuf"
    .parameter "canvas"
    .parameter "w"
    .parameter "h"

    .prologue
    .line 361
    const/16 v11, 0xc8

    .line 362
    .local v11, numSamplePerWave:I
    const/high16 v6, 0x3f80

    .line 363
    .local v6, MIN_STROKE_WIDTH:F
    const/high16 v5, 0x4040

    .line 364
    .local v5, MAX_STROKE_WIDTH:F
    const/high16 v4, 0x4040

    .line 366
    .local v4, CORNER_RADIUS:F
    invoke-virtual/range {p1 .. p1}, Ljava/nio/ShortBuffer;->limit()I

    move-result v20

    move/from16 v0, v20

    div-int/lit16 v0, v0, 0xc8

    move v10, v0

    .line 367
    .local v10, numSample:I
    move v0, v10

    move/from16 v1, p3

    if-le v0, v1, :cond_0

    move/from16 v10, p3

    .line 368
    :cond_0
    div-int/lit8 v19, p4, 0x2

    .line 369
    .local v19, yMax:I
    const/high16 v20, 0x4600

    move/from16 v0, v19

    int-to-float v0, v0

    move/from16 v21, v0

    div-float v14, v20, v21

    .line 370
    .local v14, scaleY:F
    move/from16 v0, p3

    int-to-float v0, v0

    move/from16 v20, v0

    move v0, v10

    int-to-float v0, v0

    move/from16 v21, v0

    div-float v8, v20, v21

    .line 371
    .local v8, deltaX:F
    const/4 v15, 0x1

    .line 377
    .local v15, sign:I
    new-instance v12, Landroid/graphics/Paint;

    invoke-direct {v12}, Landroid/graphics/Paint;-><init>()V

    .line 378
    .local v12, paint:Landroid/graphics/Paint;
    const/16 v20, -0x1

    move-object v0, v12

    move/from16 v1, v20

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 381
    const/high16 v20, 0x4040

    cmpl-float v20, v8, v20

    if-lez v20, :cond_1

    .line 382
    const/high16 v16, 0x4040

    .line 386
    .local v16, strokeWidth:F
    :goto_0
    move-object v0, v12

    move/from16 v1, v16

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStrokeWidth(F)V

    .line 387
    sget-object v20, Landroid/graphics/Paint$Style;->STROKE:Landroid/graphics/Paint$Style;

    move-object v0, v12

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStyle(Landroid/graphics/Paint$Style;)V

    .line 388
    const/16 v20, 0x1

    move-object v0, v12

    move/from16 v1, v20

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAntiAlias(Z)V

    .line 389
    new-instance v20, Landroid/graphics/CornerPathEffect;

    const/high16 v21, 0x4040

    invoke-direct/range {v20 .. v21}, Landroid/graphics/CornerPathEffect;-><init>(F)V

    move-object v0, v12

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setPathEffect(Landroid/graphics/PathEffect;)Landroid/graphics/PathEffect;

    .line 390
    const/16 v20, 0x0

    move/from16 v0, v19

    int-to-float v0, v0

    move/from16 v21, v0

    move-object/from16 v0, p2

    move/from16 v1, v20

    move/from16 v2, v21

    invoke-virtual {v0, v1, v2}, Landroid/graphics/Canvas;->translate(FF)V

    .line 391
    const/16 v17, 0x0

    .local v17, x:F
    const/16 v18, 0x0

    .line 392
    .local v18, y:F
    new-instance v13, Landroid/graphics/Path;

    invoke-direct {v13}, Landroid/graphics/Path;-><init>()V

    .line 393
    .local v13, path:Landroid/graphics/Path;
    move-object v0, v13

    move/from16 v1, v17

    move/from16 v2, v18

    invoke-virtual {v0, v1, v2}, Landroid/graphics/Path;->moveTo(FF)V

    .line 395
    const/4 v9, 0x0

    .local v9, i:I
    :goto_1
    if-ge v9, v10, :cond_2

    .line 396
    const/16 v20, 0xc8

    move-object/from16 v0, p0

    move-object/from16 v1, p1

    move v2, v9

    move/from16 v3, v20

    invoke-direct {v0, v1, v2, v3}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->getAverageAbs(Ljava/nio/ShortBuffer;II)I

    move-result v7

    .line 397
    .local v7, avabs:I
    move v0, v7

    int-to-float v0, v0

    move/from16 v20, v0

    div-float v20, v20, v14

    const/16 v21, 0x2

    sub-int v21, v19, v21

    move/from16 v0, v21

    int-to-float v0, v0

    move/from16 v21, v0

    invoke-static/range {v20 .. v21}, Ljava/lang/Math;->min(FF)F

    move-result v20

    move v0, v15

    int-to-float v0, v0

    move/from16 v21, v0

    mul-float v18, v20, v21

    .line 398
    move-object v0, v13

    move/from16 v1, v17

    move/from16 v2, v18

    invoke-virtual {v0, v1, v2}, Landroid/graphics/Path;->lineTo(FF)V

    .line 399
    add-float v17, v17, v8

    .line 400
    move-object v0, v13

    move/from16 v1, v17

    move/from16 v2, v18

    invoke-virtual {v0, v1, v2}, Landroid/graphics/Path;->lineTo(FF)V

    .line 401
    neg-int v15, v15

    .line 395
    add-int/lit8 v9, v9, 0x1

    goto :goto_1

    .line 384
    .end local v7           #avabs:I
    .end local v9           #i:I
    .end local v13           #path:Landroid/graphics/Path;
    .end local v16           #strokeWidth:F
    .end local v17           #x:F
    .end local v18           #y:F
    :cond_1
    const/high16 v20, 0x3f80

    const v21, 0x3d4ccccd

    sub-float v21, v8, v21

    invoke-static/range {v20 .. v21}, Ljava/lang/Math;->max(FF)F

    move-result v16

    .restart local v16       #strokeWidth:F
    goto/16 :goto_0

    .line 403
    .restart local v9       #i:I
    .restart local v13       #path:Landroid/graphics/Path;
    .restart local v17       #x:F
    .restart local v18       #y:F
    :cond_2
    move-object/from16 v0, p2

    move-object v1, v13

    move-object v2, v12

    invoke-virtual {v0, v1, v2}, Landroid/graphics/Canvas;->drawPath(Landroid/graphics/Path;Landroid/graphics/Paint;)V

    .line 404
    return-void
.end method

.method private getAverageAbs(Ljava/nio/ShortBuffer;II)I
    .locals 4
    .parameter "waveBuf"
    .parameter "index"
    .parameter "npw"

    .prologue
    .line 407
    mul-int v1, p2, p3

    .line 408
    .local v1, start:I
    const/4 v2, 0x0

    .line 409
    .local v2, total:I
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    if-ge v0, p3, :cond_0

    .line 410
    add-int v3, v0, v1

    invoke-virtual {p1, v3}, Ljava/nio/ShortBuffer;->get(I)S

    move-result v3

    invoke-static {v3}, Ljava/lang/Math;->abs(I)I

    move-result v3

    add-int/2addr v2, v3

    .line 409
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 412
    :cond_0
    div-int v3, v2, p3

    return v3
.end method

.method public static getInstance(Lcom/android/inputmethod/latin/LatinIME;Lcom/android/inputmethod/latin/VoiceKeyboardManager$VoiceInputListener;)Lcom/android/inputmethod/latin/GoogleVoiceManager;
    .locals 2
    .parameter "context"
    .parameter "listener"

    .prologue
    .line 99
    sget-object v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mInstance:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    if-nez v0, :cond_0

    .line 100
    new-instance v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;

    const/4 v1, 0x1

    invoke-direct {v0, p0, p1, v1}, Lcom/android/inputmethod/latin/GoogleVoiceManager;-><init>(Lcom/android/inputmethod/latin/LatinIME;Lcom/android/inputmethod/latin/VoiceKeyboardManager$VoiceInputListener;I)V

    sput-object v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mInstance:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    .line 113
    :goto_0
    sget-object v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mInstance:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    return-object v0

    .line 102
    :cond_0
    sget-object v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mInstance:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    iget-object v0, v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    if-eqz v0, :cond_1

    .line 103
    const-string v0, "###### GoogleVoiceManager ######"

    const-string v1, "Global instance is reused by onFinish() was not called in last usage!!"

    invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 104
    sget-object v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mInstance:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    invoke-virtual {v0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->onFinish()V

    .line 106
    :cond_1
    sget-object v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mInstance:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    iput-object p0, v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    .line 107
    sget-object v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mInstance:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    iput-object p1, v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mVIListener:Lcom/android/inputmethod/latin/VoiceKeyboardManager$VoiceInputListener;

    .line 109
    sget-object v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mInstance:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    invoke-virtual {v0, p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->initPopupWindow(Landroid/content/Context;)V

    .line 110
    sget-object v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mInstance:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    invoke-direct {v0, p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->initRecognizer(Landroid/content/Context;)V

    goto :goto_0
.end method

.method private initRecognizer(Landroid/content/Context;)V
    .locals 2
    .parameter "context"

    .prologue
    .line 143
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechRecognizer:Landroid/speech/SpeechRecognizer;

    if-eqz v0, :cond_0

    .line 144
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechRecognizer:Landroid/speech/SpeechRecognizer;

    invoke-virtual {v0}, Landroid/speech/SpeechRecognizer;->destroy()V

    .line 146
    :cond_0
    invoke-static {p1}, Landroid/speech/SpeechRecognizer;->createSpeechRecognizer(Landroid/content/Context;)Landroid/speech/SpeechRecognizer;

    move-result-object v0

    iput-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechRecognizer:Landroid/speech/SpeechRecognizer;

    .line 147
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechRecognizer:Landroid/speech/SpeechRecognizer;

    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mRecognitionListener:Landroid/speech/RecognitionListener;

    invoke-virtual {v0, v1}, Landroid/speech/SpeechRecognizer;->setRecognitionListener(Landroid/speech/RecognitionListener;)V

    .line 148
    return-void
.end method

.method private showListening()V
    .locals 4

    .prologue
    .line 280
    iget-boolean v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mIsVoiceKeyboardShown:Z

    if-eqz v0, :cond_0

    .line 281
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHandler:Landroid/os/Handler;

    new-instance v1, Lcom/android/inputmethod/latin/GoogleVoiceManager$3;

    invoke-direct {v1, p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager$3;-><init>(Lcom/android/inputmethod/latin/GoogleVoiceManager;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 288
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mUpdateVolumeRunnable:Ljava/lang/Runnable;

    invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 290
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mUpdateVolumeRunnable:Ljava/lang/Runnable;

    const-wide/16 v2, 0x32

    invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 294
    :cond_0
    const/4 v0, 0x2

    iput v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mCurrentStatus:I

    .line 296
    return-void
.end method

.method private showSpeakNow()V
    .locals 4

    .prologue
    .line 299
    iget-boolean v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mIsVoiceKeyboardShown:Z

    if-eqz v0, :cond_0

    .line 300
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mImageView:Landroid/widget/ImageView;

    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    invoke-virtual {v1}, Lcom/android/inputmethod/latin/LatinIME;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    iget-object v2, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mic_level_drawables:[I

    const/4 v3, 0x0

    aget v2, v2, v3

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 301
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mTitleView:Landroid/widget/TextView;

    const-string v1, "Speak now"

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 303
    :cond_0
    return-void
.end method

.method private showStartState()V
    .locals 3

    .prologue
    .line 268
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mImageView:Landroid/widget/ImageView;

    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    invoke-virtual {v1}, Lcom/android/inputmethod/latin/LatinIME;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    const v2, 0x7f020049

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 269
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mTitleView:Landroid/widget/TextView;

    const v1, 0x7f0a005b

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(I)V

    .line 272
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mImageView:Landroid/widget/ImageView;

    invoke-virtual {v0}, Landroid/widget/ImageView;->getScaleType()Landroid/widget/ImageView$ScaleType;

    move-result-object v0

    sget-object v1, Landroid/widget/ImageView$ScaleType;->FIT_CENTER:Landroid/widget/ImageView$ScaleType;

    if-eq v0, v1, :cond_0

    .line 273
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mImageView:Landroid/widget/ImageView;

    sget-object v1, Landroid/widget/ImageView$ScaleType;->FIT_CENTER:Landroid/widget/ImageView$ScaleType;

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setScaleType(Landroid/widget/ImageView$ScaleType;)V

    .line 275
    :cond_0
    const/4 v0, 0x1

    iput v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mCurrentStatus:I

    .line 277
    return-void
.end method

.method private showWorking(Ljava/io/ByteArrayOutputStream;II)V
    .locals 10
    .parameter "waveBuf"
    .parameter "start"
    .parameter "end"

    .prologue
    const/16 v9, 0xbb8

    const/4 v8, 0x0

    .line 324
    iget-boolean v6, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mIsVoiceKeyboardShown:Z

    if-eqz v6, :cond_1

    .line 326
    iget-object v6, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    invoke-virtual {v6}, Lcom/android/inputmethod/latin/LatinIME;->getResources()Landroid/content/res/Resources;

    move-result-object v6

    invoke-virtual {v6}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v6

    iget v4, v6, Landroid/util/DisplayMetrics;->widthPixels:I

    .line 327
    .local v4, w:I
    iget-object v6, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mImageView:Landroid/widget/ImageView;

    invoke-virtual {v6}, Landroid/widget/ImageView;->getHeight()I

    move-result v3

    .line 328
    .local v3, h:I
    if-gtz v3, :cond_0

    .line 329
    iget-object v6, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mImageView:Landroid/widget/ImageView;

    invoke-static {v8, v8}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result v7

    invoke-static {v8, v8}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result v8

    invoke-virtual {v6, v7, v8}, Landroid/widget/ImageView;->measure(II)V

    .line 331
    iget-object v6, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mImageView:Landroid/widget/ImageView;

    invoke-virtual {v6}, Landroid/widget/ImageView;->getMeasuredHeight()I

    move-result v3

    .line 332
    iget-object v6, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mImageView:Landroid/widget/ImageView;

    sget-object v7, Landroid/widget/ImageView$ScaleType;->FIT_XY:Landroid/widget/ImageView$ScaleType;

    invoke-virtual {v6, v7}, Landroid/widget/ImageView;->setScaleType(Landroid/widget/ImageView$ScaleType;)V

    .line 335
    :cond_0
    if-lez v4, :cond_1

    if-gtz v3, :cond_2

    .line 358
    .end local v3           #h:I
    .end local v4           #w:I
    :cond_1
    :goto_0
    return-void

    .line 344
    .restart local v3       #h:I
    .restart local v4       #w:I
    :cond_2
    sget-object v6, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;

    invoke-static {v4, v3, v6}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;

    move-result-object v5

    .line 345
    .local v5, wave_bmp:Landroid/graphics/Bitmap;
    new-instance v2, Landroid/graphics/Canvas;

    invoke-direct {v2, v5}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V

    .line 346
    .local v2, canvas:Landroid/graphics/Canvas;
    const/16 v0, 0xbb8

    .line 347
    .local v0, WAVE_BUFFER_ADJUST:I
    move v1, p2

    .line 348
    .local v1, adjust_start:I
    if-lt p2, v9, :cond_3

    .line 349
    sub-int v1, p2, v9

    .line 353
    :goto_1
    invoke-virtual {p1}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B

    move-result-object v6

    sub-int v7, p3, v1

    invoke-static {v6, v1, v7}, Ljava/nio/ByteBuffer;->wrap([BII)Ljava/nio/ByteBuffer;

    move-result-object v6

    invoke-static {}, Ljava/nio/ByteOrder;->nativeOrder()Ljava/nio/ByteOrder;

    move-result-object v7

    invoke-virtual {v6, v7}, Ljava/nio/ByteBuffer;->order(Ljava/nio/ByteOrder;)Ljava/nio/ByteBuffer;

    move-result-object v6

    invoke-virtual {v6}, Ljava/nio/ByteBuffer;->asShortBuffer()Ljava/nio/ShortBuffer;

    move-result-object v6

    invoke-direct {p0, v6, v2, v4, v3}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->drawWave(Ljava/nio/ShortBuffer;Landroid/graphics/Canvas;II)V

    .line 355
    iget-object v6, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mImageView:Landroid/widget/ImageView;

    invoke-virtual {v6, v5}, Landroid/widget/ImageView;->setImageBitmap(Landroid/graphics/Bitmap;)V

    .line 356
    iget-object v6, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mTitleView:Landroid/widget/TextView;

    const-string v7, "Working"

    invoke-virtual {v6, v7}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_0

    .line 351
    :cond_3
    const/4 v1, 0x0

    goto :goto_1
.end method

.method private updateVolumeLevel()V
    .locals 8

    .prologue
    .line 306
    const/high16 v1, 0x4170

    .line 307
    .local v1, MIN_MICPHONE_LEVEL:F
    const/high16 v0, 0x41f0

    .line 311
    .local v0, MAX_MICPHONE_LEVEL:F
    iget-object v5, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mVolumeSyncObj:[Ljava/lang/Byte;

    monitor-enter v5

    .line 312
    :try_start_0
    iget v4, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mVolume:F

    .line 313
    .local v4, volume:F
    monitor-exit v5
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 314
    iget-object v5, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mic_level_drawables:[I

    array-length v5, v5

    const/4 v6, 0x1

    sub-int v3, v5, v6

    .line 315
    .local v3, maxLevel:I
    cmpg-float v5, v4, v1

    if-gez v5, :cond_0

    const/4 v2, 0x0

    .line 320
    .local v2, level:I
    :goto_0
    iget-object v5, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mImageView:Landroid/widget/ImageView;

    iget-object v6, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    invoke-virtual {v6}, Lcom/android/inputmethod/latin/LatinIME;->getResources()Landroid/content/res/Resources;

    move-result-object v6

    iget-object v7, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mic_level_drawables:[I

    aget v7, v7, v2

    invoke-virtual {v6, v7}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v6

    invoke-virtual {v5, v6}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 321
    return-void

    .line 313
    .end local v2           #level:I
    .end local v3           #maxLevel:I
    .end local v4           #volume:F
    :catchall_0
    move-exception v6

    :try_start_1
    monitor-exit v5
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v6

    .line 316
    .restart local v3       #maxLevel:I
    .restart local v4       #volume:F
    :cond_0
    cmpl-float v5, v4, v0

    if-lez v5, :cond_1

    move v2, v3

    .restart local v2       #level:I
    goto :goto_0

    .line 318
    .end local v2           #level:I
    :cond_1
    sub-float v5, v4, v1

    sub-float v6, v0, v1

    div-float/2addr v5, v6

    int-to-float v6, v3

    mul-float/2addr v5, v6

    invoke-static {v5}, Ljava/lang/Math;->round(F)I

    move-result v2

    .restart local v2       #level:I
    goto :goto_0
.end method


# virtual methods
.method public createVoiceKeyboardView()Landroid/view/View;
    .locals 7

    .prologue
    .line 152
    iget-object v4, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    const v5, 0x7f030003

    const/4 v6, 0x0

    invoke-static {v4, v5, v6}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v3

    .line 153
    .local v3, voiceKeyBoardView:Landroid/view/View;
    const v4, 0x7f0b0008

    invoke-virtual {v3, v4}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v4

    check-cast v4, Landroid/widget/TextView;

    iput-object v4, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mButton:Landroid/widget/TextView;

    .line 154
    iget-object v4, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mButton:Landroid/widget/TextView;

    new-instance v5, Lcom/android/inputmethod/latin/GoogleVoiceManager$2;

    invoke-direct {v5, p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager$2;-><init>(Lcom/android/inputmethod/latin/GoogleVoiceManager;)V

    invoke-virtual {v4, v5}, Landroid/widget/TextView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 159
    const v4, 0x7f0b0007

    invoke-virtual {v3, v4}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v4

    check-cast v4, Landroid/widget/ImageView;

    iput-object v4, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mImageView:Landroid/widget/ImageView;

    .line 160
    const v4, 0x7f0b0006

    invoke-virtual {v3, v4}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v4

    check-cast v4, Landroid/widget/TextView;

    iput-object v4, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mTitleView:Landroid/widget/TextView;

    .line 162
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->getExpectedHeight()I

    move-result v1

    .line 163
    .local v1, height:I
    const v4, 0x7f0b0005

    invoke-virtual {v3, v4}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/LinearLayout;

    .line 164
    .local v2, statusContainer:Landroid/widget/LinearLayout;
    iget-object v4, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    invoke-virtual {v4}, Lcom/android/inputmethod/latin/LatinIME;->getResources()Landroid/content/res/Resources;

    move-result-object v4

    const v5, 0x7f090005

    invoke-virtual {v4, v5}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I

    move-result v0

    .line 165
    .local v0, buttonHeight:I
    new-instance v4, Landroid/widget/LinearLayout$LayoutParams;

    const/4 v5, -0x1

    sub-int v6, v1, v0

    invoke-direct {v4, v5, v6}, Landroid/widget/LinearLayout$LayoutParams;-><init>(II)V

    invoke-virtual {v2, v4}, Landroid/widget/LinearLayout;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 167
    return-object v3
.end method

.method public eligibleForVoiceRecognition(Lcom/android/inputmethod/latin/FieldContext;Landroid/view/inputmethod/EditorInfo;)Z
    .locals 1
    .parameter "fieldContext"
    .parameter "attribute"

    .prologue
    .line 118
    invoke-super {p0, p1, p2}, Lcom/android/inputmethod/latin/VoiceKeyboardManager;->eligibleForVoiceRecognition(Lcom/android/inputmethod/latin/FieldContext;Landroid/view/inputmethod/EditorInfo;)Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-virtual {p0, p1}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->isBlacklistedField(Lcom/android/inputmethod/latin/FieldContext;)Z

    move-result v0

    if-nez v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public getErrorStringId(I)I
    .locals 2
    .parameter "error"

    .prologue
    const v1, 0x7f0a000e

    .line 417
    packed-switch p1, :pswitch_data_0

    .line 435
    const v0, 0x7f0a005c

    :goto_0
    return v0

    .line 419
    :pswitch_0
    iget-boolean v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechEnded:Z

    if-eqz v0, :cond_0

    move v0, v1

    goto :goto_0

    :cond_0
    const v0, 0x7f0a000d

    goto :goto_0

    :pswitch_1
    move v0, v1

    .line 422
    goto :goto_0

    .line 424
    :pswitch_2
    const v0, 0x7f0a000f

    goto :goto_0

    .line 426
    :pswitch_3
    const v0, 0x7f0a0010

    goto :goto_0

    .line 428
    :pswitch_4
    const v0, 0x7f0a005d

    goto :goto_0

    .line 430
    :pswitch_5
    const v0, 0x7f0a0011

    goto :goto_0

    .line 432
    :pswitch_6
    const v0, 0x7f0a0012

    goto :goto_0

    .line 434
    :pswitch_7
    const v0, 0x7f0a0013

    goto :goto_0

    .line 417
    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_3
        :pswitch_4
        :pswitch_5
        :pswitch_6
        :pswitch_7
    .end packed-switch
.end method

.method public isBlacklistedField(Lcom/android/inputmethod/latin/FieldContext;)Z
    .locals 1
    .parameter "context"

    .prologue
    .line 131
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mBlacklist:Lcom/android/inputmethod/latin/Whitelist;

    invoke-virtual {v0, p1}, Lcom/android/inputmethod/latin/Whitelist;->matches(Lcom/android/inputmethod/latin/FieldContext;)Z

    move-result v0

    return v0
.end method

.method public isRecognitionAvailable(Landroid/content/Context;)Z
    .locals 1
    .parameter "context"

    .prologue
    .line 124
    invoke-static {p1}, Landroid/speech/SpeechRecognizer;->isRecognitionAvailable(Landroid/content/Context;)Z

    move-result v0

    return v0
.end method

.method public onCancel()V
    .locals 2

    .prologue
    .line 210
    invoke-super {p0}, Lcom/android/inputmethod/latin/VoiceKeyboardManager;->onCancel()V

    .line 211
    iget-boolean v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mIsErrorMessageShown:Z

    if-eqz v0, :cond_0

    .line 212
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHideErrorMessageRunnable:Ljava/lang/Runnable;

    invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 213
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mIsErrorMessageShown:Z

    .line 218
    :goto_0
    return-void

    .line 215
    :cond_0
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mUpdateVolumeRunnable:Ljava/lang/Runnable;

    invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 216
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechRecognizer:Landroid/speech/SpeechRecognizer;

    invoke-virtual {v0}, Landroid/speech/SpeechRecognizer;->cancel()V

    goto :goto_0
.end method

.method public onError(I)V
    .locals 2
    .parameter "error"

    .prologue
    .line 263
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mUpdateVolumeRunnable:Ljava/lang/Runnable;

    invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 264
    invoke-super {p0, p1}, Lcom/android/inputmethod/latin/VoiceKeyboardManager;->onError(I)V

    .line 265
    return-void
.end method

.method public onFinish()V
    .locals 4

    .prologue
    const/4 v3, 0x0

    .line 222
    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechRecognizer:Landroid/speech/SpeechRecognizer;

    invoke-virtual {v1}, Landroid/speech/SpeechRecognizer;->destroy()V

    .line 223
    iput-object v3, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mButton:Landroid/widget/TextView;

    .line 224
    iput-object v3, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mImageView:Landroid/widget/ImageView;

    .line 225
    iput-object v3, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mTitleView:Landroid/widget/TextView;

    .line 228
    :try_start_0
    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mWaveBuffer:Ljava/io/ByteArrayOutputStream;

    invoke-virtual {v1}, Ljava/io/ByteArrayOutputStream;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 232
    :goto_0
    iput-object v3, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mWaveBuffer:Ljava/io/ByteArrayOutputStream;

    .line 233
    invoke-super {p0}, Lcom/android/inputmethod/latin/VoiceKeyboardManager;->onFinish()V

    .line 234
    return-void

    .line 229
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 230
    .local v0, ex:Ljava/lang/Exception;
    const-string v1, "###### GoogleVoiceManager ######"

    const-string v2, "Error closing the wave buffer!!!"

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method protected onResume()V
    .locals 3

    .prologue
    .line 239
    invoke-super {p0}, Lcom/android/inputmethod/latin/VoiceKeyboardManager;->onResume()V

    .line 240
    iget v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mCurrentStatus:I

    packed-switch v0, :pswitch_data_0

    .line 258
    :goto_0
    return-void

    .line 242
    :pswitch_0
    invoke-direct {p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->showStartState()V

    goto :goto_0

    .line 245
    :pswitch_1
    invoke-direct {p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->showListening()V

    goto :goto_0

    .line 248
    :pswitch_2
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mWaveBuffer:Ljava/io/ByteArrayOutputStream;

    iget v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechStart:I

    iget-object v2, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mWaveBuffer:Ljava/io/ByteArrayOutputStream;

    invoke-virtual {v2}, Ljava/io/ByteArrayOutputStream;->size()I

    move-result v2

    invoke-direct {p0, v0, v1, v2}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->showWorking(Ljava/io/ByteArrayOutputStream;II)V

    goto :goto_0

    .line 251
    :pswitch_3
    iget v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mErrorNo:I

    invoke-virtual {p0, v0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->onError(I)V

    goto :goto_0

    .line 240
    nop

    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_3
    .end packed-switch
.end method

.method public showErrorMessage(Ljava/lang/String;)V
    .locals 4
    .parameter "msg"

    .prologue
    .line 441
    iget-boolean v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mIsVoiceKeyboardShown:Z

    if-eqz v0, :cond_0

    .line 443
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHideErrorMessageRunnable:Ljava/lang/Runnable;

    invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 445
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHandler:Landroid/os/Handler;

    new-instance v1, Lcom/android/inputmethod/latin/GoogleVoiceManager$4;

    invoke-direct {v1, p0, p1}, Lcom/android/inputmethod/latin/GoogleVoiceManager$4;-><init>(Lcom/android/inputmethod/latin/GoogleVoiceManager;Ljava/lang/String;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 460
    :cond_0
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHideErrorMessageRunnable:Ljava/lang/Runnable;

    const-wide/16 v2, 0x7d0

    invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 462
    return-void
.end method

.method public startRecognition(Lcom/android/inputmethod/latin/FieldContext;)V
    .locals 5
    .parameter "fieldContext"

    .prologue
    .line 172
    iget-object v2, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    if-eqz v2, :cond_0

    iget-object v2, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mVIListener:Lcom/android/inputmethod/latin/VoiceKeyboardManager$VoiceInputListener;

    if-nez v2, :cond_1

    .line 173
    :cond_0
    const-string v2, "###### GoogleVoiceManager ######"

    const-string v3, "Error starting recognition, invalid context or listener!!!"

    invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 206
    :goto_0
    return-void

    .line 177
    :cond_1
    iget-object v2, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mContext:Lcom/android/inputmethod/latin/LatinIME;

    invoke-static {v2}, Landroid/speech/SpeechRecognizer;->isRecognitionAvailable(Landroid/content/Context;)Z

    move-result v2

    if-nez v2, :cond_2

    .line 178
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->showVoiceKeyboard()V

    .line 179
    const-string v2, "Google voice unavailable!!"

    invoke-virtual {p0, v2}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->showErrorMessage(Ljava/lang/String;)V

    goto :goto_0

    .line 181
    :cond_2
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->showVoiceKeyboard()V

    .line 182
    iget-object v2, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mWaveBuffer:Ljava/io/ByteArrayOutputStream;

    if-nez v2, :cond_5

    .line 183
    new-instance v2, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v2}, Ljava/io/ByteArrayOutputStream;-><init>()V

    iput-object v2, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mWaveBuffer:Ljava/io/ByteArrayOutputStream;

    .line 187
    :cond_3
    :goto_1
    const/4 v2, 0x0

    iput v2, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechStart:I

    .line 188
    invoke-direct {p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->showStartState()V

    .line 190
    new-instance v0, Landroid/content/Intent;

    const-string v2, "android.speech.action.RECOGNIZE_SPEECH"

    invoke-direct {v0, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 191
    .local v0, i:Landroid/content/Intent;
    const-string v2, "android.speech.extra.LANGUAGE_MODEL"

    const-string v3, "free_form"

    invoke-virtual {v0, v2, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 192
    const-string v2, "android.speech.extras.RECOGNITION_CONTEXT"

    invoke-virtual {p1}, Lcom/android/inputmethod/latin/FieldContext;->getBundle()Landroid/os/Bundle;

    move-result-object v3

    invoke-virtual {v0, v2, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Bundle;)Landroid/content/Intent;

    .line 193
    const-string v2, "calling_package"

    const-string v3, "LatinIME"

    invoke-virtual {v0, v2, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 194
    const-string v2, "android.speech.extras.SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS"

    const-wide/16 v3, 0x3e8

    invoke-virtual {v0, v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;J)Landroid/content/Intent;

    .line 198
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->getLocale()Ljava/lang/String;

    move-result-object v1

    .line 199
    .local v1, locale:Ljava/lang/String;
    if-eqz v1, :cond_4

    .line 200
    const-string v2, "_"

    const-string v3, "-"

    invoke-virtual {v1, v2, v3}, Ljava/lang/String;->replaceFirst(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    .line 201
    const-string v2, "android.speech.extra.LANGUAGE"

    invoke-virtual {v0, v2, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 204
    :cond_4
    iget-object v2, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechRecognizer:Landroid/speech/SpeechRecognizer;

    invoke-virtual {v2, v0}, Landroid/speech/SpeechRecognizer;->startListening(Landroid/content/Intent;)V

    goto :goto_0

    .line 184
    .end local v0           #i:Landroid/content/Intent;
    .end local v1           #locale:Ljava/lang/String;
    :cond_5
    iget-object v2, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mWaveBuffer:Ljava/io/ByteArrayOutputStream;

    invoke-virtual {v2}, Ljava/io/ByteArrayOutputStream;->size()I

    move-result v2

    if-lez v2, :cond_3

    .line 185
    iget-object v2, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mWaveBuffer:Ljava/io/ByteArrayOutputStream;

    invoke-virtual {v2}, Ljava/io/ByteArrayOutputStream;->reset()V

    goto :goto_1
.end method
